package top.andnux.chain.sqlite;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import top.andnux.chain.entity.UserEntity;
import top.andnux.chain.entity.WalletEntity;

import top.andnux.chain.sqlite.UserEntityDao;
import top.andnux.chain.sqlite.WalletEntityDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userEntityDaoConfig;
    private final DaoConfig walletEntityDaoConfig;

    private final UserEntityDao userEntityDao;
    private final WalletEntityDao walletEntityDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userEntityDaoConfig = daoConfigMap.get(UserEntityDao.class).clone();
        userEntityDaoConfig.initIdentityScope(type);

        walletEntityDaoConfig = daoConfigMap.get(WalletEntityDao.class).clone();
        walletEntityDaoConfig.initIdentityScope(type);

        userEntityDao = new UserEntityDao(userEntityDaoConfig, this);
        walletEntityDao = new WalletEntityDao(walletEntityDaoConfig, this);

        registerDao(UserEntity.class, userEntityDao);
        registerDao(WalletEntity.class, walletEntityDao);
    }
    
    public void clear() {
        userEntityDaoConfig.clearIdentityScope();
        walletEntityDaoConfig.clearIdentityScope();
    }

    public UserEntityDao getUserEntityDao() {
        return userEntityDao;
    }

    public WalletEntityDao getWalletEntityDao() {
        return walletEntityDao;
    }

}
